package com.matt.foundation.vo.observation;

import com.matt.foundation.DO.ChildListDO;
import com.matt.foundation.DO.ChildrenCheckRecordDO;
import com.matt.foundation.DO.ChildrenCourseItemDO;
import com.matt.foundation.constant.ObservationConstant;
import lombok.Data;

import java.util.Date;
import java.util.List;

/**
 * *******************************
 * Created by Ron.
 * form com.matt
 * on 2017/8/21
 * *******************************
 */
@Data
public class ObservationChildrenListVo {
    private String id;

    private String name;

    private String imgUrl;

    private Integer gender;

    private Integer testStatus;

    private Integer checkStatus;

    private Date birthday ;

    public static ObservationChildrenListVo ofNurseryCourse(ChildrenCheckRecordDO children, List<ChildListDO> objects){
        ObservationChildrenListVo vo = new ObservationChildrenListVo();
        vo.setId(children.getChildrenId());
        vo.setName(children.getChildrenName());
        vo.setGender(children.getGender());
        vo.setTestStatus(ObservationConstant.Status.NO_TEST.codeOf());
        objects.forEach(o-> {
            if (children.getChildrenId().equals(o.getId()))
                vo.setTestStatus(ObservationConstant.Status.TESTED.codeOf());//今天已做过评测
        });
        vo.setCheckStatus(children.getCheckStatus());
        vo.setBirthday(children.getBirthday());
        return vo;
    }

    public static ObservationChildrenListVo ofEarlyCourse(ChildrenCourseItemDO item, List<ChildListDO> objects){
        ObservationChildrenListVo vo = new ObservationChildrenListVo();
        vo.setId(item.getChildrenId());
        vo.setName(item.getName());
        vo.setGender(item.getGender());
        vo.setTestStatus(ObservationConstant.Status.NO_TEST.codeOf());
        objects.forEach(o-> {
            if (item.getChildrenId().equals(o.getId()))
                vo.setTestStatus(ObservationConstant.Status.TESTED.codeOf());//今天已做过评测
        });
        vo.setCheckStatus(item.getStatus());
        vo.setBirthday(item.getBirthday());
        return vo;
    }
}
